<template>
  <div class="home">
    <Carousel :images="images"></Carousel>
    <Card @changeShow="changeShow"></Card>
    <Recommend :datas="recommendValues"></Recommend>
    <Footer></Footer>
    <!-- 遮罩层-登录 -->
    <ToLogin :show="show" @changeShow="changeShow"></ToLogin>
  </div>
</template>

<script>
import Vue from "vue";
import { Swipe, SwipeItem, Lazyload } from "vant";
import Carousel from "@/components/home/Carousel";
import Card from "@/components/home/Card";
import Recommend from "@/components/home/Recommend";
import Footer from "@/components/home/Footer";
import ToLogin from "../../components/ToLogin";

Vue.use(Swipe).use(SwipeItem).use(Lazyload);
export default {
  name: "home",
  components: {
    Carousel,
    Card,
    Recommend,
    Footer,
    ToLogin,
  },
  data() {
    return {
      show: false,
      images: [
        require("@/assets/img/bg7.jpg"),
        require("@/assets/img/bg8.jpg"),
        require("@/assets/img/bg6.jpg"),
        require("@/assets/img/bg10.jpg"),
        require("@/assets/img/bg5.jpg"),
      ],
      recommendValues: [
        {
          color: "#e3eaf2",
          title: "喜茶百货",
          desc: "气泡水新口味登场",
          img: require("@/assets/img/image1.png"),
        },
        {
          color: "#eeebdc",
          title: "阿喜团餐",
          desc: "万物新生新年赠礼",
          img: require("@/assets/img/image2.png"),
        },
        {
          color: "#f0e5e1",
          title: "阿喜有礼",
          desc: "新年送喜意",
          img: require("@/assets/img/image3.png"),
        },
      ],
    };
  },
  mounted() {
    this.$store.dispatch("setAction", 0);
  },
  computed: {},
  watch: {},
  methods: {
    changeShow() {
      if (this.show) {
        this.show = false;
      } else {
        this.show = true;
      }
    },
  },
};
</script>

<style scoped>
.home {
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  background-image: linear-gradient(to top, white, #f0f0f0);
}
</style>